package com.xujie.property_warranty_system.enums;

/**
 * 用户审核状态枚举
 */
public enum UserStatus {
    PENDING("待审核", 0),
    APPROVED("已通过", 1),
    REJECTED("已拒绝", 2);

    private final String description;
    private final Integer code;

    UserStatus(String description, Integer code) {
        this.description = description;
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public Integer getCode() {
        return code;
    }

    public static UserStatus fromCode(Integer code) {
        for (UserStatus status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("无效的用户状态代码: " + code);
    }
}